<script type="text/javascript" src="js/swfobject.js"></script>
<?php
$xml_bn = '<?xml version="1.0" encoding="utf-8"?>
<!-- Configuration panel -->
<banner width = "" height = ""
		startWith = "1" 
		random = "false"

		backgroundColor = "0xffffff" 
		backgroundTransparency = "100"
		
		cellWidth = "50"
		cellHeight = "50"
		
		showMinTime = "0.2"
		showMaxTime = "1.5"
		
		blur = "50"
		netTime = "0.5"
		alphaNet = "80"
		netColor = "0x000000"
		
		overColor = "0x473C31"
		normalColor = "0x000000"
		selectedTextColor = "0xffffff"
		
		selectedButtonAlpha = "70"
		
		controllerVisible = "true"
		controllerBackgroundVisible = "true"
		
		prevNextVisible = "true"
		playBtVisible = "true"
		autoPlay = "true"
		navigationButtonsColor = "0x1a1a1a"
		
		controllerDistanceX = "4"
		controllerDistanceY = "4"
		
		controllerHeight = "20"
		distanceBetweenControllerElements = "10"
		distanceBetweenThumbs = "3"
		
		itemNumberSize = "14"
		
		captionY = "2"
		captionX = "2"			
		
		captionWidth = "525"


		
		loaderColor = "0x000000">
<!-- End panel -->

';
$db->connectdb(DB_NAME,DB_USERNAME,DB_PASSWORD);
$res['ran'] = $db->select_query("SELECT * FROM ".TB_RANDOM." where status='1' ORDER BY id DESC limit 10");
//captionWidth = "525"
//captionWidth = "505"
while($arr['ran'] = $db->fetch($res['ran'])){
$rmbnimg			= "../../icon/".$arr['ran']['rm_image'];
$rmbnimg_arr		= explode("\n",$rmbnimg);
$rmbntopic			= $arr['ran']['rm_topic'];
$rmbntopic_arr		= explode("\n",$rmbntopic);
$rmbntext				= $arr['ran']['rm_detail'];
$rmbntext_arr		= explode("\n",$rmbntext);
$rmbnurl				=  $arr['ran']['rm_link'];
$rmbnurl_arr		= explode("\n",$rmbnurl);
if(ISO=='utf-8'){
$rmbntopic			= $arr['ran']['rm_topic'];
$rmbntopic_arr		= explode("\n",$rmbntopic);
$rmbntext				= $arr['ran']['rm_detail'];
$rmbntext_arr		= explode("\n",$rmbntext);
} else {
$rmbntopic		= tis620_to_utf8($arr['ran']['rm_topic']);
$rmbntopic_arr	= explode("\n",$rmbntopic);
$rmbntext			= tis620_to_utf8($arr['ran']['rm_detail']);
$rmbntext_arr	= explode("\n",$rmbntext);
}
foreach ($rmbnimg_arr  as $ib=>$curr_isrc) {
	$xml_bn .= '
	<item>
		<path>' . trim($curr_isrc) . '</path>
		<title><![CDATA[<font color="#990000">'. trim($rmbntopic_arr [$ib]) . '</font>]]></title>
		<caption><![CDATA[<font color="#000033">'. trim($rmbntext_arr [$ib]) . '</font>]]></caption>
		
		<target>_blank</target>
		<link>' . trim($rmbnurl_arr [$ib]) . '</link>
		
		<bar_color>0xffffff</bar_color>
		<bar_transparency>40</bar_transparency>
		
		<caption_color>0xffffff</caption_color>
		<caption_transparency>60</caption_transparency>
		
		<stroke_color>0xffffff</stroke_color>
		<stroke_transparency>40</stroke_transparency>
		
		<slideshowTime>10</slideshowTime>
	</item>

';
}

}


$xml_bn .= '</banner>';

$module_path = WEB_PATH;
$xml_data_filename = $module_path.'/modules/block/banner.xml';
$xml_prodgallery_file = fopen($xml_data_filename,'w');
fwrite($xml_prodgallery_file, $xml_bn);
fclose($xml_prodgallery_file);

?>

<script type="text/javascript">
			
			// JAVASCRIPT VARS
			// cache buster
			var cacheBuster = "?t=" + Date.parse(new Date());
			// stage dimensions		
			var stageW = <? echo $widthCU; ?>;//"100%";
			var stageH = "250";//"100%";
			
			
			// ATTRIBUTES
			var attributes = {};
			attributes.id = 'FlabellComponent';
			attributes.name = 'FlabellComponent';

			// PARAMS
			var params = {};
			params.bgcolor = "#ffffff";
		    params.menu = "false";
		    params.scale = 'noScale';
		    params.wmode = "opaque";
		    params.allowfullscreen = "true";
		    params.allowScriptAccess = "always";			

			
			/* FLASH VARS */
			var flashvars = {};
			
			/// if commented / delete these lines, the component will take the stage dimensions defined 
			/// above in "JAVASCRIPT SECTIONS" section or those defined in the settings xml
		    flashvars.componentWidth = stageW;
			flashvars.componentHeight = stageH;

			/// path to the content folder(where the xml files, images or video are nested)
			/// if you want to use absolute paths(like "http://domain.com/images/....") then leave it empty("")			
			flashvars.pathToFiles = "modules/block/";
			
			// path to content XML
			flashvars.xmlPath = "banner.xml";

			
			/** EMBED THE SWF**/
			swfobject.embedSWF("modules/block/preview.swf"+cacheBuster, attributes.id, stageW, stageH, "9.0.124", "js/expressInstall.swf", flashvars, params, attributes);
			
		</script>
	
		<table width="100%" height="100%" cellpadding="0" cellspacing="0">
			<td align="center">
				
				<!-- this div will be overwritten by SWF object -->		
				<div id="FlabellComponent">
					<p>In order to view this object you need Flash Player 9+ support!</p>
					<a href="http://www.adobe.com/go/getflashplayer">
						<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player"/>
					</a>
				</div>
			
			</td>
		</table>    <br>    
